﻿using Microsoft.Phone.Tasks;
using System.Windows;
using MijnMultiOSRSSApp.Common.Resources;

namespace MijnMultiOSRSSApp.Common.Helpers
{
    public class ReviewNotification
    {
        public static void TriggerReviewNotification()
        {
            var startupCounter = Storage.LoadPersistent<int>("StartupCounter");
            var notifyReview = false;
            if (startupCounter != 10) return;

            if (!Storage.LoadPersistent<bool>("ReviewNotified"))
                notifyReview = true;

            if (!notifyReview) return;
            if (MessageBox.Show(AppResources.ReviewReminderMessage, AppResources.ReviewReminderTitle,
                                MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                new MarketplaceReviewTask().Show();
            Storage.SavePersistent("ReviewNotified", true);
        }
    }
}
